
# -- 最简单能力接入

import os , sys


'''

简单能接入


#查看注册信息
python capability_1_simple.py  register

#启动服务器
python capability_1_simple.py  server

#服务器调用

    访问地址:
    http://127.0.0.1:5000/capability/capability_1_simple/methods/simple_function

    return:
    {
        "code": 0,
        "msg": "OK",
        "data": "[simple_function]这是最简单的能力"
    }



    访问地址:
    http://127.0.0.1:5000/capability/capability_1_simple/methods/simple_function_by_get_params

    params:
    {
        "xxx": "eeeeee"
    }

    return:
    {
        "code": 0,
        "message": "[simple_function_by_get_params]成功,params:{'xxx': 'eeeeee'}"
    }



#命令行调用

    #单独调用方法
    python capability_1_simple.py  simple_function

    return:
    {
        "code": 0,
        "msg": "OK",
        "data": "[simple_function]这是最简单的能力"
    }

    # 带参数调用方法
    python capability_1_simple.py  simple_function_by_get_params  --params ICAgIHsKICAgICAgICAieHh4IjogImVlZWVlZSIKICAgIH0=

    return:
    {
        "code": 0,
        "msg": "OK",
        "data": "[simple_function_by_get_params]成功,params{'xxx': 'eeeeee'}"
    }






'''



# 1. 引入能力装饰器
from pycapabilitydecorator  import capability



# 2. 定义能力
@capability.option()
def simple_function():

# 3. 返回能力结果
    return {
        "code": 0,
        "msg": "OK",
        "data": "[simple_function]这是最简单的能力"
    }


@capability.option()
def simple_function_by_get_params(params):

# 4. 带参数返回能力结果
    return {
        "code": 0,
        "msg": "OK",
        "data": f"[simple_function_by_get_params]成功,params{params}"
    }
